Skip to content

Avoid target directories within the source directory getting stuck. #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed

Conversation

Fleuv
Copy link
Contributor

@Fleuv Fleuv commented Jan 11, 2019

Currently when you run:

$filesystem->mirror('/foo', '/foo/bar');

The method will get caught in a recursive loop of creating "bar" sub directories in the target directory.

This will happen:

/foo/bar/bar/
/foo/bar/bar/bar/
/foo/bar/bar/bar/bar/
...

Until the path is so long that is validated as an invalid path string and thus mkdir() crashes.

In this pull request I implemented an if statement at the beginning of the foreach in the mirror() method. This if statement ensures that the target directory in the mirror process is skipped.

Fleuv added 2 commits January 11, 2019 20:33
…or(), called testMirrorAvoidCopyingTargetDirectoryIfInSourceDirectory
@symfony-bot
Copy link

symfony-bot bot commented Jan 11, 2019

Thanks for your pull request! We love contributions.

However, this repository is what we call a "subtree split": a read-only copy of one directory of the main Symfony repository. It is used by Composer to allow developers to depend on specific Symfony components.

If you want to contribute, you should instead open a pull request on the main repository:

https://github.com/symfony/symfony

Thank you for your contribution!

PS: if you haven't already, please add tests, and beware that bug fixes should be submitted on the lowest maintained branch where they apply; only features should be submitted against the master branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant